package homework2;

public class Person {
	public void drive(Car car) {
		if (car == null) {
			return;
		}
		car.run();
		if (car instanceof MilitaryVehicle) {
			MilitaryVehicle mv = (MilitaryVehicle)car;
			mv.fireGun();
		} else if (car instanceof OxCart) {
			OxCart oxCart = (OxCart)car;
			oxCart.eatGrass();
		} else if (car instanceof Truck) {
			Truck truck = (Truck)car;
			truck.transport();
		}
	}
}
